package cn.pupil.springframework.context.support;

import cn.pupil.springframework.beans.factory.support.DefaultListableBeanFactory;
import cn.pupil.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * @Description: XML应用上下文抽象类，处理了关于 XML 文件配置信息的操作
 * @Author: pupil
 * @Date: 2024/11/6 下午 2:55
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {
    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configLocations = getConfigLocations();
        if (null != configLocations) {
            beanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    /**
     * 获取配置信息的地址描述
     *
     * @return
     */
    protected abstract String[] getConfigLocations();
}
